package cn.itlaobing.eshopmanagement.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.itlaobing.eshopmanagement.entity.Member;
import cn.itlaobing.eshopmanagement.service.MemberService;
/**
 * 会员管理
 * @author classA-43
 *
 */
@Controller
@RequestMapping("/members")
public class MemberController extends BaseController{
	@Autowired
	private MemberService memberService;
	
	/**
	 * 显示会员列表主页
	 * @return
	 */
	@GetMapping
	public String index(Model model){
		List<Member> list= memberService.findBySearchFilter(buildPageRequestSearchFilter());
		model.addAttribute("members", list);
		return "member/index";
	}
	/**
	 * 查看会员详情
	 * @param id
	 * @param model
	 * @return
	 */
	@GetMapping("/{id}")
	public String show(@PathVariable Long id ,Model model){
		model.addAttribute("member",memberService.selectById(id));
		return "member/show";
	}
	
}
